﻿using System;
using System.Data;
using System.Collections.Generic;
using EnterpriseFund.Model;
namespace EnterpriseFund.BLL
{
    /// <summary>
    /// VSBZSXX
    /// </summary>
    public partial class VSBZSXX
    {
        private readonly EnterpriseFund.DAL.VSBZSXX dal = new EnterpriseFund.DAL.VSBZSXX();
        public VSBZSXX()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string FDataSource, decimal ZSXH)
        {
            return dal.Exists(FDataSource, ZSXH);
        }

        public DataSet GetKeyNsrRKQKAll(int y, int m)
        {
            return dal.GetKeyNsrRKQKAll(y, m);
        }

        public DataSet GetKeyNsrRKQKhy(DateTime startDate, DateTime endDate)
        {
            return dal.GetKeyNsrRKQKhy(startDate, endDate);
        }

        public DataSet GetKeyNsrRKQK(int y, int m)
        {
            return dal.GetKeyNsrRKQK(y, m);
        }

        public DataSet GetAllowanceWaitList(string strWhere, string strWhere2, string year)
        {
            return dal.GetAllowanceWaitList(strWhere, strWhere2, year);
        }
        public DataSet GetAllowanceWaitListWithAllwance(string strWhere, string strWhere2,string year)
        {
            return dal.GetAllowanceWaitListWithAllwance(strWhere, strWhere2,year);
        }
                /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetListByAuditLookEntry(string strWhere)
        {
            return dal.GetListByAuditLookEntry(strWhere);
        }

                /// <summary>
        /// 获取审核数据
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="strWhere"></param>
        /// <param name="fOrderFiled"></param>
        /// <returns></returns>
        public DataSet GetDataforQueryAllowanceForecast(string beginDate, string endDate, string Year)
        {
            return dal.GetDataforQueryAllowanceForecast(beginDate, endDate, Year);
        }


        public string GetRejectTaxSqlByYear(string fyear)
        {
            return dal.GetRejectTaxSqlByYear(fyear);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EnterpriseFund.Model.VSBZSXX GetModel(string FDataSource, decimal ZSXH)
        {

            return dal.GetModel(FDataSource, ZSXH);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<EnterpriseFund.Model.VSBZSXX> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<EnterpriseFund.Model.VSBZSXX> DataTableToList(DataTable dt)
        {
            List<EnterpriseFund.Model.VSBZSXX> modelList = new List<EnterpriseFund.Model.VSBZSXX>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                EnterpriseFund.Model.VSBZSXX model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  BasicMethod
        #region  ExtensionMethod

        /// <summary>
        /// 获取税款剔除条件
        /// </summary>
        public string GetRejectTaxSql(DateTime beginDate, DateTime endDate)
        {            
            return dal.GetRejectTaxSql(beginDate, endDate);
        }

        public DataTable QueryTax(string strWhere)
        {
            DataTable dt = dal.GetExtendList(strWhere).Tables[0];
           
            return dt;
        }

        #endregion  ExtensionMethod
    }
}

